REST API
BindAI v0.1 includes a FastAPI-based REST API package for exposing configured BindAI applications over HTTP. The API provides a lightweight service boundary around:- Agents
- Workflows
- Projects
- Background automation runs
Installation
Install the API package from PyPI:- FastAPI
- Pydantic
- Uvicorn
- BindAI
uv workflow.
API Application
The main FastAPI application is exposed as:API Version
The current REST API uses versioned resource paths:Health Check
The API provides a public health endpoint:- Local development
- Docker health checks
- Deployment infrastructure
- Basic service monitoring
Authentication
Protected API endpoints require API-key authentication. Configure the API key through the environment:Authorization header:
/health endpoint remains public.
The v0.1 authentication implementation intentionally uses a single environment-based API key.
It does not provide:
- User accounts
- OAuth
- Persistent API-key management
- Role-based access control
- Multi-tenant authorization
BINDAI_API_KEY is configured, a missing or incorrect Bearer token results in 401 Unauthorized.
If BINDAI_API_KEY itself is not configured, the current authentication dependency raises a server-side configuration error rather than performing normal API-key validation.
See the Authentication documentation for complete details.
Agents
The Agents API provides agent discovery and execution. Base path:List Agents
Retrieve the agents available from the configured BindAI application:Run an Agent
Execute an agent synchronously:Agent Streaming
Agents can also be executed through the streaming endpoint:StreamingResponse.
The v0.1 implementation is intentionally lightweight.
It is not a separate distributed streaming service and does not define persistent stream-management infrastructure.
For additional details, see the Streaming documentation.
Agent Execution Flow
A typical request follows this flow:Workflows
The Workflows API provides workflow discovery and execution. Base path:List Workflows
Retrieve the configured workflows:Run a Workflow
Execute a workflow:Workflow Execution
Workflow execution remains part of the BindAI runtime. The API does not replace workflow orchestration. A configured workflow can use the BindAI capabilities available to it, such as:- Agents
- Tools
- Conditions
- Loops
- Parallel execution
- Retry policies
- Timeouts
- Human tasks
- Connections
Projects
The Projects API exposes projects configured in the current API process. Base path:List Projects
Retrieve configured projects:Get a Project
Retrieve a project by name:Project Storage
The v0.1 Projects API uses an in-process project registry. It does not provide a persistent project-management database. Conceptually:Background Runs
BindAI v0.1 exposes background automation runs through:Submit a Background Run
Create a background automation run:202 Accepted.
The request is accepted for background execution rather than waiting for the automation to complete.
Get Run Status
Retrieve a background run:- Run ID
- Automation definition ID
- Definition version
- Status
- Input
- Output
- Error
- Creation time
- Start time
- Completion time
Background Execution Model
The REST API delegates background automation execution toAutomationWorker.
For v0.1, the worker uses an in-process thread pool.
Conceptually:
AutomationRun before submitting the execution to its thread pool.
The API can therefore return the run representation without waiting for the automation to finish.
The background execution model is intentionally lightweight for the initial public release.
It does not require an external message broker or distributed queue.
Background Run Input
The background-run request supports aninput value:
AutomationRun.
The current AutomationWorker implementation does not automatically pass that input as an argument to AutomationDefinition.run().
Therefore, applications should not assume that the input field is automatically delivered to the automation target.
How an automation consumes input depends on the automation definition and surrounding application design.
Background Execution Limitations
Background execution in v0.1 is process-local. The worker uses a PythonThreadPoolExecutor and maintains its state and run history in process-local stores by default.
This has important operational consequences.
For example:
API and Runtime Configuration
The API application must be configured with the BindAI application it is intended to expose. The API package provides:Docker
The BindAI repository includes a Dockerfile for running the API. Build the image from the repository root:Docker Compose
The repository also includes Docker Compose configuration. Start the API:Environment Variables
The API authentication layer requires:Error Responses
The API uses HTTP status codes to represent request outcomes. Examples include:BINDAI_API_KEY is missing, the current authentication dependency can raise a server-side configuration error.
API Security
The v0.1 API provides a deliberately simple authentication mechanism. When exposing the API outside a trusted local environment, deployment infrastructure should additionally consider:- HTTPS
- Network access controls
- Reverse proxies
- Rate limiting
- Request limits
- Secret management
- Logging
- Monitoring
- Process isolation
API and Observability
BindAI’s event system can be used alongside the REST API. The runtime can emit structured events for areas such as:- Application lifecycle
- Agent execution
- Workflow execution
- Node execution
- Human tasks
- Model requests and responses
- Tool execution
- Memory operations
- MCP connection events
EventRecorder.
The recorder can be used for:
- Development
- Debugging
- Execution inspection
- Custom logging
- Application-level monitoring integrations
API Deployment Architecture
A simple BindAI API deployment can be represented as:- TLS
- Networking
- Secrets
- Process management
- Persistent storage
- Monitoring
- Scaling
- Backups
Scaling
The v0.1 API can be deployed behind standard HTTP infrastructure. However, horizontal scaling requires careful consideration of application state. For example:- Configured projects
- Background execution
- Runtime state
- In-memory observability
- Other process-local resources
Distributed Background Execution
Queue-based background execution is outside the initial v0.1 API scope. A future architecture could look like:- Durable execution
- Multiple workers
- Work recovery
- Coordinated execution
- Horizontal scaling
Testing
The API package has its own test suite. Run the API tests with:Local API Validation
A simple local validation sequence is: Start the API:Current API Scope
BindAI v0.1 provides the following public REST API surface.Health
Agents
Workflows
Projects
Background Runs
Current Limitations
The v0.1 API intentionally keeps the service layer lightweight. The current API does not provide:- Persistent project management
- Persistent API-key management
- User accounts
- OAuth authentication
- RBAC
- Multi-tenancy
- Distributed job queues
- Durable distributed workers
- Kubernetes-specific infrastructure
- Hosted monitoring dashboards
- Built-in billing
API Design Principles
The v0.1 REST API follows several simple principles:- Keep the API surface small.
- Use versioned resource paths.
- Reuse the existing BindAI runtime.
- Keep authentication explicit.
- Keep deployment infrastructure separate from application logic.
- Avoid introducing persistent infrastructure unless required.
- Make background execution available without requiring an external queue.
- Preserve the Python API as the underlying framework interface.
Summary
The BindAI REST API provides an HTTP interface for running and inspecting configured BindAI applications. The main resource areas are:- Health checks
- API-key authentication
- Agent discovery
- Agent execution
- Agent streaming
- Workflow discovery
- Workflow execution
- Project access
- Background automation runs
- Background run status
- Docker deployment
- Docker Compose deployment
